<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
						<input id="id" name="id" th:value="${loanApply.id}"  type="hidden">
							<div class="form-group">	
								<label class="col-sm-2 control-label" ><span style="color:red">当前</span>申请金额：</label>
								<div style="top: 8px;" class="col-sm-2" th:text="${loanApply.applyAmount}"></div>
								<label class="col-sm-2 control-label"><span style="color:red">当前</span>放款金额：</label>
								<div style="top: 8px;" class="col-sm-2" th:text="${loanApply.loanAmount}"></div>
								<label class="col-sm-2 control-label"><span style="color:red">当前</span>借款利息：</label>
								<div style="top: 8px;" class="col-sm-2" th:text="${loanApply.remark1}"></div>
								<label class="col-sm-2 control-label"><span style="color:red">当前</span>贷款利率：</label>
								<div style="top: 8px;" class="col-sm-2" th:text="${loanApply.loanRate}"></div>
							</div>
							<div class="form-group">	
								<label class="col-sm-2 control-label"><span style="color:red">当前</span>还款方式：</label>
								<div style="top: 8px;" class="col-sm-2" th:text="${loanApply.remark9}"></div>
								<label class="col-sm-2 control-label"><span style="color:red">当前</span>借款已还：</label>
								<div style="top: 8px;" class="col-sm-2" th:text="${loanApply.remark2}"></div>
								<label class="col-sm-2 control-label"><span style="color:red">当前</span>借款应还：</label>
								<div style="top: 8px;" class="col-sm-2" th:text="${loanApply.remark3}"></div>
								<label class="col-sm-2 control-label"><span style="color:red">当前</span>放款时间：</label>
								<div style="top: 8px;" class="col-sm-2" th:text="${loanApply.remark5}"></div>
								<label class="col-sm-2 control-label"><span style="color:red">当前</span>贷款期间：</label>
								<div style="top: 8px;" class="col-sm-2" th:text="${loanApply.loanPeriod}"></div>
							</div>
							<!-- <div class="form-group">	
								
							</div> -->
							<div class="form-group">	
								<label class="col-sm-2 control-label"><span style="color:red">当前</span>贷款产品：</label>
								<div style="top: 8px;" class="col-sm-8" th:text="${loanApply.loanProductName}"></div>
							</div>
							<!-- <div class="form-group">	
								<label class="col-sm-3 control-label"><span style="color:red">当前</span>还款时间：</label>
								<div style="top: 8px;" class="col-sm-8" th:text="${loanApply.remark4}"></div>
							</div> -->
							<!-- <div class="form-group">	
								<label class="col-sm-3 control-label"><span style="color:red">当前</span>逾期金额：</label>
								<div style="top: 8px;" class="col-sm-8"></div>
							</div>
							<div class="form-group">	
								<label class="col-sm-3 control-label"><span style="color:red">当前</span>逾期时间：</label>
								<div style="top: 8px;" class="col-sm-8"></div>
							</div> -->
						</form>
					</div>
				</div>
			</div>
	</div>
	</div>
	
	
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
							<div class="form-group">	
								<label class="col-sm-2 control-label">还款人员</label>
								<label class="col-sm-2 control-label">还款期数</label>
								<label class="col-sm-2 control-label">还款金额</label>
								<label class="col-sm-2 control-label">还款时间</label>
								<label class="col-sm-2 control-label">还款状态</label>
								<label class="col-sm-2 control-label">操&nbsp;&nbsp;作</label>
							</div>
							
							<div class="form-group" th:each="repay:${repays}">	
									<label class="col-sm-2 control-label" th:text="${repay.userName}"></label>
									<label class="col-sm-2 control-label">第<span th:text="${repay.period}"></span>期</label>
									<label class="col-sm-2 control-label" th:text="${repay.amt}"></label>
									<label class="col-sm-2 control-label" th:text="${#dates.format(repay.repayTime, 'yyyy-MM-dd')}"></label>
									<label class="col-sm-2 control-label">
									<span th:if="${repay.status} eq 0"><span style="color: red;" th:id="${repay.id}">未还款</span></span>
									<span th:if="${repay.status} eq 1"><span style="color:#0d3cf3;">已还款</span></span>
									<span th:if="${repay.status} eq 2"><span style="color:#f30d55;" th:id="${repay.id} + 'code'">已逾期</span></span>
									</label>
									<label class="col-sm-2 control-label">
									<span th:if="${repay.status} ne 1">
										<button class="btn btn-success" th:onclick="'javascript:repayBtn('+${repay.id}+')' "  th:id="${repay.id} + 'repay'">还款</button>
										<span style="dispaly:none" th:id="${repay.id} + 'show'">--</span>
									</span>
									<span th:if="${repay.status} eq 1">--</span>
									</label>
							</div>
					</div>
				</div>
			</div>
	</div>
	</div>
	<div th:include="include::footer"></div>
	
<script th:inline="javascript">
    function repayBtn(id) {
    	layer.confirm('确定要对此笔还款嘛？', {
    		btn : [ '确定', '取消' ]
    	}, function() {
    		$.ajax({
    			url : "/system/repayLog/update",
    			type : "post",
    			data : {
    				'id' : id
    			},
    			success : function(r) {
    				if (r.code==0) {
    					layer.msg("还款成功");
    					reLoad();
    					$("#"+id).html("已还");
    					$("#"+id+"code").html("已还");
    					$("#"+id+"repay").hide();
    					$("#"+id+"show").show();
    				}else{
    					layer.msg("还款失败");
    				}
    			}
    		});
    	})
    }
    
    function reLoad() {
    	$('#exampleTable').bootstrapTable('refresh');
    }
</script>
<script type="text/javascript">


</script>
</body>
</html>
